<!DOCTYPE html>
<html>
<head>
    <title>查看--中软高科-2015</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>

    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    <script type="text/javascript" src="../Js/ckeditor/ckeditor.js"></script>
 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <script type="text/javascript">
    $(function () {       
		$('#backid').click(function(){
				window.location.href="index.html";
		 });
    });
    </script>
</head>
<body>
<form action="index.html" method="post" class="definewidth m20">
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">药品编号</td>
        <td><span id="drug_id">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">图片</td>
        <td><img name="url" src="1.png"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">进价</td>
        <td><span id="inPrice">-</span>元</td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">售价</td>
        <td><span id="outPrice">-</span>元</td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">药品名称</td>
        <td><span id="drug_name">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">药品类型</td>
        <td><span id="drug_type">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">简单描述</td>
        <td><span id="drug_simDesc">-</span></td>
    </tr>

    <tr>
        <td width="10%" class="tableleft">过期日期</td>
        <td><span id="drug_endDate">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">详细描述</td>
        <td><span id="drug_detaDesc">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">生产厂商</td>
        <td><span id="drug_fatory">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">服用说明</td>
        <td><span id="drug_direction">-</span></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">库存</td>
        <td><span id="drug_number">-</span></td>
    </tr>
	<tr>
        <td width="10%" class="tableleft">备注</td>
        <td><span id="drug_remark">-</span></td>
	</tr>
    <tr>
        <td colspan="2">
			<center>
				<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
			</center
		</td>
    </tr>
</table>
</form>
</body>
</html>
<script>
    String.prototype.GetValue= function(para) {
        let reg = new RegExp("(^|&)"+ para +"=([^&]*)(&|$)");
        let r = this.substr(this.indexOf("\?")+1).match(reg);
        if (r!=null) return unescape(r[2]); return null;
    }
    $(function () {
        //根据地址获取Id,如果null则执行增加，否则执行更新
        let url = document.location.toString();//获取URL
        let drug_id=url.GetValue("drug_id");
        queryById(drug_id);

        function queryById(drug_id) {
            $.ajax({
                type: "GET",
                url: "/drug/" + drug_id, //RESTful风格的API定义
                data: "",
                success: function (vo) {
                    let obj = vo.obj;
                    let drug_id = obj.drug_id;
                    let url = obj.drug_url;
                    let inPrice = obj.drug_inPrice;
                    let outPrice = obj.drug_outPrice;
                    let name = obj.drug_name;
                    let type = obj.drug_type;
                    let simDesc = obj.drug_simDesc;
                    let detaDesc = obj.drug_detaDesc;
                    let endDate = obj.drug_endDate;
                    let fatory = obj.drug_fatory;
                    let direction = obj.drug_direction;
                    let number =  obj.drug_number;
                    let remark = obj.drug_remark;
                    $("img[name='url']").attr("src","/Images/uploadFile/"+url);
                    $("#drug_id").html(drug_id);
                    $("#inPrice").html(inPrice)
                    $("#outPrice").html(outPrice);
                    $("#drug_name").html(name);
                    $("#drug_type").html(type);
                    $("#drug_simDesc").html(simDesc);
                    $("#drug_detaDesc").html(detaDesc);
                    $("#drug_endDate").html(endDate);
                    $("#drug_fatory").html(fatory);
                    $("#drug_direction").html(direction);
                    $("#drug_number").html(number);
                    $("#drug_remark").html(remark);
                }
            })
        }
    })
</script>